package org.thanos.iot.service.graphic.impl;

import com.honeywell.tj.iot.entity.graphic.GraphicComponent;
import com.honeywell.tj.iot.mapper.graphic.GraphicComponentMapper;
import com.honeywell.tj.iot.service.graphic.GraphicComponentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("graphicComponentService")
public class GraphicComponentServiceImpl implements com.honeywell.tj.iot.service.graphic.GraphicComponentService {

    @Resource
    private GraphicComponentMapper graphicComponentMapper;

    @Override
    public GraphicComponent getComponent(Integer componentId) {
        return graphicComponentMapper.selectComponentById(componentId);
    }

    @Override
    public List<GraphicComponent> getComponentsByCategoryId(Integer categoryId) {
        return graphicComponentMapper.selectComponentsByCategoryId(categoryId);
    }

    @Override
    public List<GraphicComponent> getComponentByCategoryIds(List<Integer> categoryIds) {
        return graphicComponentMapper.selectComponentsByCategoryIds(categoryIds);
    }

    @Override
    public int createComponent(GraphicComponent graphicComponent) {
        return graphicComponentMapper.insertComponent(graphicComponent);
    }

    @Override
    public int updateComponent(GraphicComponent graphicComponent) {
        return graphicComponentMapper.updateComponent(graphicComponent);
    }

    @Override
    public int deleteComponent(Integer componentId) {
        return graphicComponentMapper.deleteComponent(componentId);
    }

    @Override
    public int deleteComponents(List<Integer> ids) {
        return graphicComponentMapper.deleteComponentsByIds(ids);
    }
}
